<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="keywords" content="">
    <meta itemprop="name" content="">
    <meta name="description" itemprop="description" content="">
    <title>国网2018“两会”精神学习 挑战赛</title>
    <link rel="stylesheet" href="__PUBLIC__/index/index.css?v=213">
    <base target='_blank'>
</head>

<body>
<div id="pageHome" class="page out" data-title=''>
    <div class="content">
        <div class="title">国网2018“两会”精神学习</div>
        <b class="tz">挑战赛</b>
        <img src="__PUBLIC__/index/images/book.png" alt="" class="book">
        <a href="#pagetitle" class="next-page"></a>
    </div>
    <div class="index_support in">
        <div class="index_support-inner">
            <p>主&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp办：国家英大传媒</p>
            <p>平台支撑：电网头条客户端</p>

        </div>
    </div>
</div>

<div id="pagetitle" class="page1 page out" data-title=''>
    <div class="content">
        <div class="lltit">
            <img src="__PUBLIC__/index/images/lltit.png" alt="理论大比拼">
        </div>
        <div class="about">
            <p>贯彻公司两会精神</p>
            <p>全方位知识点等您挑战</p>
            <p>答完可以看各省排行榜哦！</p>
            <p>更可以分享给你身边的人</p>
            <p>一起来比拼！</p>
        </div>
        <div class="login_box">
            <div>
                <form>
                    <p><span>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</span><input type="text" class="loginInfo" id="username"></p>
                    <p><span>单&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位：</span><input type="text" class="loginInfo" id="company"></p>
                    <p><span>手机号码：</span><input type="text" class="loginInfo" id="mobile"></p>
                </form>
            </div>
        </div>
        <div class="start_btn" onclick="userinfo()">
            <a href="" class="begin">开始答题</a>
        </div>
    </div>
</div>
{volist name="single_list" id="vo" key="key"}
<div id="single_{$key}" class="page out" data-title=''>
    <div class="page_main" style="">
        <div class="page_num"> <span>{$key}/{$list_count.single_count}</span> </div>
        <div class="page_QA">
            <div class="page_Q">{$vo.topic}</div>
            <div class="page_A">
                <ol class="answer" data-answer="{$vo.answer}" data-id = {$vo.id}>
                    {foreach name="vo.select" item="v" key="k" }
                        <li onclick="sign_select(this)" data-answer="{$k}"> <span class="page_A-icon">{$k}、</span>
                            <div class="page_A-text-textImg">
                                <span class="page_A-text">{$v}</span>
                                <img class="page_A-img {if condition='$k eq $vo.answer'}_yes{/if}" style="display: none;" src="__PUBLIC__/index/images/{if condition='$k eq $vo.answer'}page6_corrent.png{else /}page6_error.png{/if}">
                            </div>
                        </li>
                    {/foreach}
                </ol>
            </div>
        </div>
        <div class="page_pagination" id="next_{$vo.id}" >
            <!--{if condition='$list_count.single_count eq $key'}
            <a class="pagination_next _next" href="" onclick="onResult()">提交</a>
            {else /}
            {/if}-->
            <a class="pagination_submit _next" data-url="#single_{$key+1}" data-count="{$key}" data-id = {$vo.id}  onclick="submit_ans(this)">提交</a>

        </div>
        <input type="hidden" value="" id="">
    </div>
</div>
{/volist}
<div id="result" class="page4 page out">
    <div class="page4_welcome">
        <img src="__PUBLIC__/index/images/page4_head.png">
        <i id="ranks">你是第1位挑战者</i>
    </div>
    <div class="page4_info">
        <p class="page4_info_answer">答对<i class="page4_info_answer_number" id="answer_num">1</i>道题，获得<i
                class="page4_info_answer_score" id="answer_score">10</i>分</p>
        <div class="page4_info_btn_two clearfix">
            <img class="page4_info_btn_two_left" id="_repeat"
                 src="__PUBLIC__/index/images/btn_repeatAnswer.png">
            <img class="page4_info_btn_two_right" id="share"
                 src="__PUBLIC__/index/images/btn_share.png">
        </div>

        <p class="page4_rank">
            <span><label><span id="city_name">深圳</span>当前总分：</label><i id="city_score">17,947,360</i> 分</span>
            <span><label>省排名：</label><i>
                         1
                    </i></span>
        </p>

    </div>
    <div class="page4_rankTop">
        <ul class="page4_rankTop_list active" id="rank_list">
            <li class="page4_rankTop_item borderPx1 page4_rankTop_item_first">
                <div class="page4_rankTop_rank">
                    <i>1</i>
                    <img src="__PUBLIC__/index/images/page4_img01.png">
                </div>
                <p class="page4_rankTop_province">北京</p>
                <p class="page4_rankTop_score">17,947,360分</p>
            </li>
            <li class="page4_rankTop_item borderPx1 page4_rankTop_item_first">
                <div class="page4_rankTop_rank">
                    <i>2</i>
                    <img src="__PUBLIC__/index/images/page4_img02.png">
                </div>
                <p class="page4_rankTop_province">山东</p>
                <p class="page4_rankTop_score">8,965,470分</p>
            </li>
            <li class="page4_rankTop_item borderPx1 page4_rankTop_item_first">
                <div class="page4_rankTop_rank">
                    <i>3</i>
                    <img src="__PUBLIC__/index/images/page4_img03.png">
                </div>
                <p class="page4_rankTop_province">河北</p>
                <p class="page4_rankTop_score">7,780,230分</p>
            </li>
            <li class="page4_rankTop_item borderPx1">
                <div class="page4_rankTop_rank">
                    <div class="page4_rankTop_rank_bg">
                        <i>4</i>
                    </div>
                </div>
                <p class="page4_rankTop_province">江苏</p>
                <p class="page4_rankTop_score">7,669,390分</p>
            </li>

        </ul>
    </div>
    <div class="page4_rankTop_topBg"></div>
</div>
<div class="page4_share_overlay">
    <img class="page4_share_overlay_img" src="https://cdns1.dajiashequ.com/da19/v20/share.png">
    <div class="page4_share_overlay_text">
        <p>点击右上角</p>
        <p>分享到 微信群 或者 朋友圈</p>
        <p>邀请好友一起答题吧！</p>
    </div>
    <input type="hidden" id="questionnaireID" value="3528737025448363593"/>
    <input type="hidden" id="questionnaireResultID" value="210595175132448107"/>
    <input type="hidden" id="baseUrl" value="https://19th5.rmlt.com.cn/index/19da"/>
    <input type="hidden" id="isInWeChat" value="no"/>
    <input type="hidden" id="myRank" value="0"/>
    <input type="hidden" id="provinceName" value="北京"/>
    <input type="hidden" id="myScore" value="10"/>
</div>
<script type="text/javascript" src='__PUBLIC__/index/zepto-1.2.0.min.js'></script>
<script type="text/javascript" src='__PUBLIC__/index/mobilebone.js'></script>
<script type="text/javascript" src='__PUBLIC__/index/index.js?v=12313'></script>
<script>
        var user_data = new Array();
        var myAnswer=new Array();
        var allData=new Array();
        var arrs = [];
        var title_count = {$list_count.single_count};

        function userinfo() {
            var username = $("#username").val();
            var company = $("#company").val();
            var mobile = $("#mobile").val();
            if(!username){
                alert('请填写姓名');return false;
            }
            if(!company){
                alert('请填写单位');return false;
            }
            if(!mobile){
                alert('请填写手机');return false;
            }
            var myreg = /^(((13[0-9]{1})|(17[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
            if(!myreg.test(mobile))
            {
                alert('请输入有效的手机号码！');
                return false;
            }
            user_data = {
                'username':username,
                'company':company,
                'mobile':mobile,
            }
            time = 1;
            var url = "{:url('index/index/checkjoin')}";
            $.post(url, user_data, function (data) {
                if (data.code == 1) {
                    location.href = "#single_1";
                } else {
                    alert('每日最多答题3次,明天再来吧');
                }
            });

        }


        var myAnswer=new Array();

        function sign_select(obj){
            var id = $(obj).parent('.answer').attr("data-id");
            var answer = $(obj).attr("data-answer");
            if (!contains(arrs,id)) {
                myAnswer[id] = answer;
                $(obj).parent('.answer').find('.selected').removeClass('selected');
                $(obj).children('span').addClass("selected");
            }
        }

        function submit_ans(obj) {

            var id = $(obj).attr("data-id");
            if (!contains(arrs,id)) {
                console.log(myAnswer[id]);
                if (myAnswer[id] == 'undefined') {
                    alert('请选择答案');
                    return false;
                }
                arrs.push(id);
                $(obj).parent().prev().find(".page_A-img").css("display","inline-block");
                $(obj).removeClass('pagination_submit').addClass('pagination_next');
            }else {
                if ($(obj).attr("data-count") == title_count) {
                    onResult();
                }else {
                    location.href=$(obj).attr("data-url");
                }

            }


        }

        function contains(arr, obj) {
            var i = arr.length;
            while (i--) {
                if (arr[i] === obj) {
                    return true;
                }
            }
            return false;
        }

        function multi_select(obj){
            $(obj).parent('.answer').find('.selected').removeClass('selected');
            $(obj).children('span').addClass("selected");
            var answer = $(obj).attr("data-answer");
            var id = $(obj).parent('.answer').attr("data-id");
            //图片显示
            $(obj).parent().find(".page_A-img").css("display","inline-block");
            myAnswer[id] = answer;
            //显示下一步按钮
            $("#next_"+id).css("display","block");

        }

        function onResult(){
            allData = {
                'user_data':user_data,
                'topic_data':myAnswer
            }
            console.log(allData);
            var url1 = "/index/index/saveData";
            $.post(url1,allData,function(data){
                if(data.code == 1) {
                    console.log(data.data);
                    $('#city_name').text(data.data.city);
                    $('#city_score').text(parseInt(data.data.city_score) + parseInt(data.data.score));
                    $('#answer_num').text(data.data.number);
                    $('#answer_score').text(data.data.score);
                    $('#ranks').text("你是第"+ data.data.rank +"位挑战者");
                    console.log(data.data.city_lists);
                    var lists = data.data.city_lists;
                    var str='';
                    for(var p in lists){
                        if (p == 0) {
                            str += " <li class=\"page4_rankTop_item borderPx1 page4_rankTop_item_first\">" +
                                "                <div class=\"page4_rankTop_rank\">" +
                                "                    <i>1</i>" +
                                "                    <img src=\"__PUBLIC__/index/images/page4_img01.png\">" +
                                "                </div>" +
                                "                <p class=\"page4_rankTop_province\">"+lists[p].city+"</p>" +
                                "                <p class=\"page4_rankTop_score\">"+lists[p].number+"分</p>" +
                                "            </li>"
                        }else if (p==1) {
                            str += " <li class=\"page4_rankTop_item borderPx1 page4_rankTop_item_first\">" +
                                "                <div class=\"page4_rankTop_rank\">" +
                                "                    <i>2</i>" +
                                "                    <img src=\"__PUBLIC__/index/images/page4_img01.png\">" +
                                "                </div>" +
                                "                <p class=\"page4_rankTop_province\">"+lists[p].city+"</p>" +
                                "                <p class=\"page4_rankTop_score\">"+lists[p].number+"分</p>" +
                                "            </li>"
                        }else if (p==2) {
                            str += " <li class=\"page4_rankTop_item borderPx1 page4_rankTop_item_first\">" +
                                "                <div class=\"page4_rankTop_rank\">" +
                                "                    <i>3</i>" +
                                "                    <img src=\"__PUBLIC__/index/images/page4_img01.png\">" +
                                "                </div>" +
                                "                <p class=\"page4_rankTop_province\">"+lists[p].city+"</p>" +
                                "                <p class=\"page4_rankTop_score\">"+lists[p].number+"分</p>" +
                                "            </li>"
                        }else {
                            str += " <li class=\"page4_rankTop_item borderPx1\">" +
                                "<div class=\"page4_rankTop_rank\">" +
                                "    <div class=\"page4_rankTop_rank_bg\">" +
                                "         <i>"+(parseInt(p)+1)+"</i>" +
                                "    </div>"+
                                "</div>"+
                                "<p class=\"page4_rankTop_province\">"+lists[p].city+"</p>" +
                                "<p class=\"page4_rankTop_score\">"+lists[p].number+"分</p>" +
                                "</li>"
                        }

                    }
                    $('#rank_list').html(str);
                    location.href="#result";
                }else {
                    alert(data.msg)
                }
            })

        }


</script>
</body>

</html>
